package com.leviassaf.al_app_one;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.BaseAdapter;

public abstract class BaseListElement {
	private Drawable drawableIcon;
	private BaseAdapter baseAdapter;
	
	protected void onActivityResult(Intent data){}
	
	protected void onSaveInstanceState(Bundle bundle) {}
	
	protected boolean restoreState(Bundle savedState){
		return false;
	}
	
	protected void notifyDataChanged(){
		baseAdapter.notifyDataSetChanged();
	}
	
	protected abstract View.OnClickListener getOnClickListener();
	
	public BaseListElement(Drawable icon, String text1, String text2, int requestCode) {
		super();
		this.drawableIcon = icon;
		this.strText1 = text1;
		this.strText2 = text2;
		this.intRequestCode = requestCode;
	}
	
	private String strText1;
	private String strText2;
	private int intRequestCode;

	public String getText1() {
		return strText1;
	}
	public void setText1(String strText1) {
		this.strText1 = strText1;
		if (baseAdapter != null){
			baseAdapter.notifyDataSetChanged();
		}
	}
	public String getText2() {
		return strText2;
	}
	public void setText2(String strText2) {
		this.strText2 = strText2;
		if (baseAdapter != null){
			baseAdapter.notifyDataSetChanged();
		}
	}
	public Drawable getIcon() {
		return drawableIcon;
	}
	public int getRequestCode() {
		return intRequestCode;
	}
	public void setAdapter(BaseAdapter baseAdapter) {
		this.baseAdapter = baseAdapter;
	}
}
